TO_BIG_ENDIAN block

Short summary

Name

TO_BIG_ENDIAN

→POU type

→function

Category

IEC-block, Convert

Conform to →IEC-standard

(error) currently restricted(IEC additionally demands the WCHAR, array and structure data types for the input and the return value. Currently, these data types are not supported for the block.)

and

(plus) more possible than defined in IEC-standard
(IEC demands ANY_INTANY_BIT,  ANY_REALWCHARTIME, array and structure data types for the input and the return value. Hence, IEC does not demand the data types DATE_AND_TIMETIME_OF_DAY and DATE, but they are supported in Neuron Power Engineer.)

Graphical interface

Available since

version 1.35.0 (for Neuron Power Engineer)

Functionality

The block converts a value (entered at input IN and existing in the appropriate →endian format of the target system) into the big-endian format.

Special case: The conversion result for the data types TIMEDATETIME_OF_DAY and DATE_AND_TIME depends on the timer frequency of the target system (see under "Properties and restrictions specific to the target system"). Therefore, different values might be returned on different target systems.

Inputs, return value

 

Identifier

→Data type

Description

Inputs:

IN

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDDATE_AND_TIMEDATE or TIME_OF_DAY

input value

Return value:

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDDATE_AND_TIMEDATE or TIME_OF_DAY

 

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

PROGRAM Test
    VAR
        result1: INT;
        result2: DINT;
        result3: LWORD;
    END_VAR
    result1 := TO_BIG_ENDIAN(IN := INT#16#1234);                 (* The variable 'result1' evaluates to 'INT#16#3412' (decimal: 13_330). *)
    result2 := TO_BIG_ENDIAN(IN := DINT#16#12345678);            (* The variable 'result2' evaluates to 'DINT#16#78563412' (decimal: 2_018_915_346). *)
    result3 := TO_BIG_ENDIAN(IN := LWORD#16#1234567890ABCDEF);   (* The variable 'result3' evaluates to 'LWORD#16#EFCDAB9078563412' (decimal: 17_279_655_982_273_016_850). *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.